package com.youoor.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class CommonUtils {

		
	/**
	 * 用户密码加密
	 * @param password
	 * @param salt
	 * @return
	 */
	public static String MD5Password(String password, String salt) {
		return MD5Utils.getMD5Str(password + salt);
	}
	
	/**
	 * salt
	 * @param length
	 * @return
	 */
	public static String getRandomString(int length) {
	    String base = "abcdefghijklmnopqrstuvwxyz0123456789";     
	    Random random = new Random();     
	    StringBuffer sb = new StringBuffer();     
	    for (int i = 0; i < length; i++) {     
	        int number = random.nextInt(base.length());     
	        sb.append(base.charAt(number));     
	    }     
	    return sb.toString();     
	 }     
	
	/**
	* 日期转换成字符串
	* @param date 
	* @return str
	*/
	public static String DateToStr(Date date) {
	  
	   SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
	   String str = format.format(date);
	   return str;
	}
	
	public static String getshuoshuo() {
		String[] shuoArr = new String[]{"加油吧,年轻人!","有那么一点点想你","没事逗逗你","加油吧,年轻人!","有那么一点点想你","没事逗逗你"};
		int k=0;
		Random random = new Random();
		k = random.nextInt(6);
		return shuoArr[k];
	}
	
	public static int getRandomInt(int n) {
		return (int) (Math.random()*n);
	}
 
	public static void main(String[] args) {
		int k=0;
		Random random = new Random();
		k = random.nextInt(3);
		System.out.println(k);
	}
}
